import numpy 

a = numpy.loadtxt("./mat_drug_drug.txt")
# pos = 0
# neg = 0

# for i in a:
#     for j in i:
#         if j == 1 :
#             pos += 1
#         else :
#             neg += 1
# print("pos"+str(pos))
# print("neg"+str(neg))
b = numpy.loadtxt("./scores.txt")
for i in b:
    d1 = i[0]
    d2 = i[1]
    p  = i[2]
    if a[int(d1)][int(d2)] == 1:
        pass
    else:
        if p > 0.3:
            print(str(d1)+" "+str(d2)+" "+str(p)) 